/***************************************************************************
 *   Copyright (C) 2008 by Justin L. Boss                                  *
 *   justin@rtechguys.com                                                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include <QGLWidget>
#include <math.h>

#ifndef GUIDANCESYSTEM_H
#define GUIDANCESYSTEM_H

static const GLfloat RADIAN = 57.29577951308232087685;		// 180/3.14159265358979323846

class GuidanceSystem : public QGLWidget
{
private:
    GLfloat ActYDeg;										//Actual degree to object
    GLfloat ActZDeg;

    GLfloat ObjXDeg;										//Object Degree
    GLfloat ObjZDeg;
    GLfloat ObjYDeg;

    GLfloat dx;												//Destination
    GLfloat dy;
    GLfloat dz;

protected:
    GLfloat DirIncX;
    GLfloat DirIncY;
    GLfloat DirIncZ;

public:
    GLfloat *gsMatrix;
    GLfloat RotIncX;
    GLfloat RotIncY;
    GLfloat RotIncZ;

    GLfloat Agility;

    bool Arrived;

    GLfloat x;												//Actual x, y, z location of object
    GLfloat y;
    GLfloat z;

    GuidanceSystem();
    ~GuidanceSystem();
    void gsBegin(int speed);
    void gsEnd();
    void SetAgility(GLint agility);
    void SetLocation (GLfloat X, GLfloat Y, GLfloat Z);		//Move Creature to location in 3d space.
    void SetDestination (GLint X, GLint Y,  GLint Z);
};

#endif
